import forum.utils.djangofix
from forum.models.base import BaseMetaClass
from forum.models.question import Question ,QuestionRevision, QuestionSubscription
from forum.models.answer import Answer, AnswerRevision
from forum.models.tag import Tag, MarkedTag
from forum.models.user import User, ValidationHash, AuthKeyUserAssociation, SubscriptionSettings
from forum.models.node import Node, NodeRevision, NodeState, NodeMetaClass
from forum.models.comment import Comment
from forum.models.action import Action, ActionRepute
from forum.models.meta import Vote, Flag, Badge, Award
from forum.models.utils import KeyValue
from forum.models.page import Page
from django.db import models

try:
    from south.modelsinspector import add_introspection_rules
    add_introspection_rules([], [r"^forum\.models\.\w+\.\w+"])
except:
    pass


__all__ = [
        'Node', 'NodeRevision', 'NodeState',  
        'Question', 'QuestionSubscription', 'QuestionRevision',
        'Answer', 'AnswerRevision',
        'Tag', 'Comment', 'MarkedTag', 'Badge', 'Award',
        'ValidationHash', 'AuthKeyUserAssociation', 'SubscriptionSettings', 'KeyValue', 'User',
        'Action', 'ActionRepute', 'Vote', 'Flag', 'Page'
        ]


from forum.modules import get_modules_script_classes

for k, v in get_modules_script_classes('models', models.Model).items():
    if not k in __all__:
        __all__.append(k)
        exec ("%s = v" % k)

NodeMetaClass.setup_relations()
BaseMetaClass.setup_denormalizes()
